<div class="row-fluid">
    <form action=""  method="get" class="form-search span9 well">
        <input type="text" name="username" placeholder="Nazwa Użytkownika" class="input-large">
        <button type="submit" class="btn"> Search </button>
    </form>

    <form action="admin_user/add" class="span2">                      
        <button type="submit" 
                class ="btn btn-success pull-right" 
                style="background-color: green"/>
        <i class="icon-plus icon-white"></i>
        Dodaj użytkownika
        <div class ="row">
            </button>
    </form>                   

</div>
<?php if(isset($messenger)): ?>
<div class="alert alert-success span10">
    <?php echo $messenger->action_messages().'<br>' ?>
    <button type="button" class="close" data-dismiss="alert">X</button>
</div>
<?php endif; ?>
<div class="row-fluid">
    Użytkownicy:                
    <?php if(!isset($users[0])) echo 'Brak wyników.' ?>
    <table class=" table table-striped table-bordered">
        <thead>
            <tr>
                <th>
                    Login
                </th>
                <th>
                    E-mail
                </th>
                <th>
                    Opcje
                </th>
            </tr>
        </thead>

        <tbody>    

            <?php foreach($users as $user): ?>
            <tr>
                <th>
                    <?php echo $user->username ?>
                </th>
                <th>
                    <?php echo $user->email ?>
                </th>

                <td>
                    <a href="admin_user/edit/<?php echo $user->id ?>"><i class="icon-pencil"></i></a>
                    <a href="javascript:decision('Czy na pewno chcesz usunąć tego użytkownika?',
                    'admin_user/delete/<?php echo $user->id ?>')"><i class="icon-remove"></i></a>
                </td>
            </tr>

            <?php endforeach; ?>

        </tbody>

    </table>

</div>
</div>
</div>
<script>
    function decision(message, url){
    if(confirm(message)) location.href = url;
    }
</script>